Moves a folder along with all its sub-folders and files. It can also rename a folder.
FileMoveDir, Source, Dest [, Flag]
Source | Name of the source directory (with no trailing backslash), which is assumed to be in %A_WorkingDir% if an absolute path isn't specified. For example: C:\My Folder |
Dest | Name of the destination directory (with no trailing baskslash), which is assumed to be in %A_WorkingDir% if an absolute path isn't specified. For example: D:\My Folder |
Flag | (options) Specify one of the following single characters: 0 (default): Do not overwrite existing files. The operation will fail if Dest already exists as a file or directory. 1: Overwrite existing files. However, any files or subfolders inside Dest that do not have a counterpart in Source will not be deleted. Known limitation: If Dest already exists as a folder and it is on the same volume as Source, Source will be moved into it rather than overwriting it. To avoid this, see the next option. 2 [v1.0.38+]: Overwrite existing files without the limitation described above. R: Rename the directory rather than moving it. Although renaming normally has the same effect as moving, it is helpful in cases where you want "all or none" behavior; that is, when you don't want the operation to be only partially successful when Source or one of its files is locked (in use). Although this method cannot move Source onto a different volume, it can move it to any other directory on its own volume. The operation will fail if Dest already exists as a file or directory. |
ErrorLevel is set to 1 if there was a problem or 0 otherwise.
FileMoveDir moves a single folder to a new location. To instead move the contents of a folder (all its files and subfolders), see the examples section of FileMove.
If the source and destination are on different volumes or UNC paths, a copy/delete operation will be performed rather than a move.
FileCopyDir, FileCopy, FileMove, FileDelete, File-loops, FileSelectFolder, SplitPath
FileMoveDir, C:\My Folder, D:\My Folder ; Move to a new drive.
FileMoveDir, C:\My Folder, C:\My Folder (renamed), 1